package com.nuanshui.heatedloan.controller.display.weexconfig;

import com.alibaba.dubbo.config.annotation.Reference;
import com.nuanshui.heatedloan.constant.GlobalParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.nuanshui.heatedloan.baseservice.facade.WeexVersionService;
import com.nuanshui.heatedloan.baseservice.vo.WeexVersionVO;
import com.nuanshui.heatedloan.controller.BaseController;

@RestController
public class WeexVersionController  extends BaseController{


	@Reference(url = GlobalParam.BASESERVICE_DUBBO_SERVER, timeout = GlobalParam.DUBBO_SERVER_TIME_OUT,version = GlobalParam.USER_DUBBO_SERVER_VERSION)
	private WeexVersionService weexVersionService;
	
	/**
	 * 
	 * @author Gonzo
	 * @date 2017年1月5日下午7:02:16
	 * @param nativeVersionCode 本地原生版本号
	 * @param jsVersionCode 当前本地js版本号
	 * @param platForm 0：android 1： ios
	 * @return
	 * @since 1.0.0
	 */
	@RequestMapping(value = "/updateInfo",method = RequestMethod.POST)
	public String updateInfo(String nativeVersionCode, String jsVersionCode, Integer platForm){
		WeexVersionVO weexVersionVO = weexVersionService.loadWeexVersionByClientInfo(nativeVersionCode, jsVersionCode, platForm);
		//改为本地不判断, 直接拿最新的一个.
		//WeexVersionVO weexVersionVO = weexVersionService.loadLatestWeexVersion(platForm, jsVersionCode);
		return success(weexVersionVO);
	}

}
